package stackmachine.command;

import stackmachine.IP;
import stackmachine.StackItem;
import stackmachine.command.Command;

import java.util.LinkedList;

public class NumberCommand extends Command {
    private Integer value;

    public NumberCommand(Integer value) {
        this.value = value;
    }

    @Override
    public boolean commit(LinkedList<StackItem> stack, LinkedList<StackItem> out, IP ip) {
        stack.addLast(new StackItem<Integer>(value));
        ip.increment();
        return true;
    }
}
